﻿// <copyright file="MyApplicationService.cs" company="Microsoft Corporation">
// Copyright (c) 2009 Microsoft Corporation All Rights Reserved
// </copyright>
// <author>Michael S. Scherotter</author>
// <email>mischero@microsoft.com</email>
// <date>2010-08-20</date>
// <summary>MyApplicationService class definition</summary>

namespace WindowsPhoneListApplication
{
    using System.ComponentModel.Composition.Hosting;
    using System.Windows;
    using Google.WebAnalytics;
    using Microsoft.WebAnalytics;
    using Microsoft.WebAnalytics.Behaviors;

    /// <summary>
    /// Application service that initializes the MEF composition host
    /// </summary>
    public class MyApplicationService : IApplicationService
    {
        #region IApplicationService Members

        /// <summary>
        /// Initialize the MEF composition host with the assemblies
        /// </summary>
        /// <param name="context">the application service context</param>
        public void StartService(ApplicationServiceContext context)
        {
            CompositionHost.Initialize(
                new AssemblyCatalog(Application.Current.GetType().Assembly),
                new AssemblyCatalog(typeof(AnalyticsEvent).Assembly),
                new AssemblyCatalog(typeof(TrackAction).Assembly),
                new AssemblyCatalog(typeof(GoogleAnalytics).Assembly));
        }

        /// <summary>
        /// Do nothing
        /// </summary>
        public void StopService()
        {
        }

        #endregion
    }
}
